class UserAddress {
  UserAddress({
      this.id, 
      this.userId, 
      this.recipientName, 
      this.phone, 
      this.province, 
      this.city, 
      this.district, 
      this.detail, 
      this.isDefault, 
      this.tag, 
  });

  UserAddress.fromJson(dynamic json) {
    id = json['id'];
    userId = json['userId'];
    recipientName = json['recipientName'];
    phone = json['phone'];
    province = json['province'];
    city = json['city'];
    district = json['district'];
    detail = json['detail'];
    isDefault = json['isDefault'];
    tag = json['tag'];

  }
  String? id;
  String? userId;
  String? recipientName;
  String? phone;
  String? province;
  String? city;
  String? district;
  String? detail;
  bool? isDefault;
  String? tag;


  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['userId'] = userId;
    map['recipientName'] = recipientName;
    map['phone'] = phone;
    map['province'] = province;
    map['city'] = city;
    map['district'] = district;
    map['detail'] = detail;
    map['isDefault'] = isDefault;
    map['tag'] = tag;
    return map;
  }

  // 获取完整地址
  String get fullAddress {
    return '${province ?? ''}${city ?? ''}${district ?? ''}${detail ?? ''}';
  }

  // 是否为默认地址
  bool get isDefaultAddress {
    return isDefault ?? false;
  }
}